<!DOCTYPE HTML>
<html lang="zh-tw" >
    
    <head>
        
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>串行通信过程及实例 | 51 单片机笔记</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.5.2">
        
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="../gitbook/style.css">
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-highlight/website.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-search/search.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-fontsettings/website.css">
        
    
    

        
    
    
    <link rel="next" href="../4-external/index.html" />
    
    
    <link rel="prev" href="../3-communication/几个用到的寄存器.html" />
    

        
    </head>
    <body>
        
        
    <div class="book" data-level="3.3" data-chapter-title="串行通信过程及实例" data-filepath="3-communication/串行通信过程及实例.md" data-basepath=".." data-revision="Sat Nov 14 2015 21:21:46 GMT+0800 (CST)">
    

<div class="book-summary">
    <nav role="navigation">
        <ul class="summary">
            
            
            
            

            

            
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="../index.html">
                
                        <i class="fa fa-check"></i>
                        
                        简介
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1" data-path="1-basic/index.html">
            
                
                    <a href="../1-basic/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                        基础知识
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1" data-path="1-basic/51单片机引脚.html">
            
            <span><b>1.1.</b> 51单片机引脚</span>
            
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="1-basic/符号注释.html">
            
                
                    <a href="../1-basic/符号注释.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.</b>
                        
                        符号注释
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="1-basic/寻址方式.html">
            
                
                    <a href="../1-basic/寻址方式.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.3.</b>
                        
                        寻址方式
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="1-basic/数据传送类指令.html">
            
                
                    <a href="../1-basic/数据传送类指令.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.4.</b>
                        
                        数据传送类指令
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="1-basic/算术运算类指令.html">
            
                
                    <a href="../1-basic/算术运算类指令.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.5.</b>
                        
                        算术运算类指令
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="1-basic/逻辑运算类指令.html">
            
                
                    <a href="../1-basic/逻辑运算类指令.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.6.</b>
                        
                        逻辑运算类指令
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="1-basic/控制转移类指令.html">
            
                
                    <a href="../1-basic/控制转移类指令.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.7.</b>
                        
                        控制转移类指令
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="1-basic/布尔处理类指令.html">
            
                
                    <a href="../1-basic/布尔处理类指令.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.8.</b>
                        
                        布尔处理类指令
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2" data-path="2-interruption/index.html">
            
                
                    <a href="../2-interruption/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.</b>
                        
                        中断系统
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1" data-path="2-interruption/中断允许寄存器.html">
            
                
                    <a href="../2-interruption/中断允许寄存器.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.</b>
                        
                        中断允许寄存器 IE
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="2-interruption/中断优先级寄存器.html">
            
                
                    <a href="../2-interruption/中断优先级寄存器.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.</b>
                        
                        中断优先级寄存器 IP
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="2-interruption/定时、计数器控制寄存器.html">
            
                
                    <a href="../2-interruption/定时、计数器控制寄存器.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.</b>
                        
                        定时/计数器控制寄存器 TCON
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="2-interruption/T、C的模式寄存器.html">
            
                
                    <a href="../2-interruption/T、C的模式寄存器.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.4.</b>
                        
                        T/C的模式寄存器 TMOD
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.5" data-path="2-interruption/中断处理过程.html">
            
                
                    <a href="../2-interruption/中断处理过程.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.5.</b>
                        
                        中断处理过程
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.6" data-path="2-interruption/定时计数器.html">
            
                
                    <a href="../2-interruption/定时计数器.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.6.</b>
                        
                        定时计数器
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3" data-path="3-communication/index.html">
            
                
                    <a href="../3-communication/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.</b>
                        
                        串行通信
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1" data-path="3-communication/几个知识点.html">
            
                
                    <a href="../3-communication/几个知识点.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.1.</b>
                        
                        几个知识点
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="3-communication/几个用到的寄存器.html">
            
                
                    <a href="../3-communication/几个用到的寄存器.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.2.</b>
                        
                        几个用到的寄存器
                    </a>
            
            
        </li>
    
        <li class="chapter active" data-level="3.3" data-path="3-communication/串行通信过程及实例.html">
            
                
                    <a href="../3-communication/串行通信过程及实例.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.3.</b>
                        
                        串行通信过程及实例
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4" data-path="4-external/index.html">
            
                
                    <a href="../4-external/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.</b>
                        
                        外部扩展
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1" data-path="4-external/存储器的扩展.html">
            
                
                    <a href="../4-external/存储器的扩展.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.1.</b>
                        
                        存储器的扩展
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.2" data-path="4-external/与外设的数据传输.html">
            
                
                    <a href="../4-external/与外设的数据传输.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.2.</b>
                        
                        与外设的数据传输 8255
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.3" data-path="4-external/数模转换器.html">
            
                
                    <a href="../4-external/数模转换器.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.3.</b>
                        
                        数模转换器 DAC0832
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.4" data-path="4-external/模数转换器.html">
            
            <span><b>4.4.</b> 模数转换器 ADC0809</span>
            
            
        </li>
    

            </ul>
            
        </li>
    


            
            <li class="divider"></li>
            <li>
                <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                    本書使用 GitBook 釋出
                </a>
            </li>
            
        </ul>
    </nav>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header" role="navigation">
    <!-- Actions Left -->
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../" >51 单片机笔记</a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1" role="main">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <h3 id="&#x4E32;&#x884C;&#x901A;&#x4FE1;&#x8FC7;&#x7A0B;&#x53CA;&#x5B9E;&#x4F8B;">&#x4E32;&#x884C;&#x901A;&#x4FE1;&#x8FC7;&#x7A0B;&#x53CA;&#x5B9E;&#x4F8B;</h3>
<hr>
<h4 id="&#x5DE5;&#x4F5C;&#x65B9;&#x5F0F;&#xFF08;sm0-sm1&#xFF09;">&#x5DE5;&#x4F5C;&#x65B9;&#x5F0F;&#xFF08;<code>SM0</code> <code>SM1</code>&#xFF09;</h4>
<ul>
<li><p>&#x5DE5;&#x4F5C;&#x65B9;&#x5F0F; 0 &#xFF1A;&#x540C;&#x6B65;&#x79FB;&#x4F4D;&#x5BC4;&#x5B58;&#x5668;&#xFF0C;&#x6CE2;&#x7279;&#x7387; <script type="math/tex; ">\frac{1}{12f_{OSC}}</script></p>
<ul>
<li>&#x53D1;&#x9001;<ol>
<li>&#x5C06;&#x6570;&#x636E;&#x5199;&#x5165; <code>SBUF</code> &#xFF1B;</li>
<li>&#x7531; <code>RXD</code> (<code>P3.0</code>) &#x53D1;&#x9001;&#x6570;&#x636E;&#xFF0C;<code>TXD</code> (<code>P3.1</code>) &#x53D1;&#x9001;&#x540C;&#x6B65;&#x79FB;&#x4F4D;&#x8109;&#x51B2;&#xFF1B;</li>
<li>&#x6BCF;&#x53D1;&#x9001;&#x4E00;&#x4F4D;&#x6570;&#x636E;&#xFF0C;&#x82B1;&#x8D39;&#x4E00;&#x4E2A;&#x673A;&#x5668;&#x5468;&#x671F;&#xFF1B;</li>
<li>&#x53D1;&#x9001;&#x7ED3;&#x675F;&#xFF0C;&#x7F6E; <code>TI</code> &#x4E3A; <code>1</code> &#xFF0C;&#x54CD;&#x5E94;&#x4E2D;&#x65AD;&#x540E;&#xFF0C;&#x987B;<strong>&#x7F16;&#x7A0B;</strong>&#x6E05; <code>0</code> &#x3002;</li>
</ol>
</li>
<li>&#x63A5;&#x6536;<ol>
<li><code>1</code> -&gt; <code>REN</code> &#xFF0C;<code>0</code> -&gt; <code>RI</code> &#xFF1B;</li>
<li>&#x6BCF;&#x4E2A;&#x673A;&#x5668;&#x5468;&#x671F;&#x7684; S6P2 &#x5BF9; <code>RXD</code> &#x91C7;&#x6837;&#xFF0C;<code>TXD</code> &#x8F93;&#x51FA;&#x540C;&#x6B65;&#x8109;&#x51B2;&#xFF1B;</li>
<li>&#x6BCF;&#x8BFB;&#x4E00;&#x4F4D;&#x6570;&#x636E;&#xFF0C;&#x82B1;&#x8D39;&#x4E00;&#x4E2A;&#x673A;&#x5668;&#x5468;&#x671F;&#xFF0C;&#x5E76;&#x5C06;&#x5176;&#x5199;&#x5165; <code>SBUF</code> &#xFF1B;</li>
<li>&#x63A5;&#x6536;&#x5B8C;&#x6210;&#xFF0C;&#x7F6E;&#x4F4D; <code>RI</code> &#x4E3A; <code>1</code> &#xFF0C;&#x54CD;&#x5E94;&#x4E2D;&#x65AD;&#x540E;&#xFF0C;&#x987B;<strong>&#x7F16;&#x7A0B;</strong>&#x6E05; <code>0</code> &#x3002;</li>
</ol>
</li>
</ul>
</li>
<li><p>&#x5DE5;&#x4F5C;&#x65B9;&#x5F0F; 1 &#xFF1A;8&#x4F4D; UART<sup><a href="#fn_UART" id="reffn_UART">UART</a></sup>&#xFF0C;&#x6CE2;&#x7279;&#x7387; &#x53EF;&#x53D8;</p>
<ul>
<li>&#x7531; <code>T/C1</code> &#x63D0;&#x4F9B;&#x6CE2;&#x7279;&#x7387;&#xFF1B;</li>
<li>&#x4EFB;&#x4F55;&#x4E00;&#x6761;&#x4EE5; <code>SBUF</code> &#x4E3A;&#x76EE;&#x7684;&#x64CD;&#x4F5C;&#x6570;&#x7684;&#x6307;&#x4EE4;&#xFF0C;&#x90FD;&#x4F1A;&#x542F;&#x52A8;&#x53D1;&#x9001;&#x8FC7;&#x7A0B;&#xFF1B;</li>
<li>1 &#x5E27;&#x6570;&#x636E; = 1 &#x8D77;&#x59CB;&#x4F4D; + 8 &#x6570;&#x636E;&#x4F4D; + 1 &#x505C;&#x6B62;&#x4F4D;&#xFF1B;</li>
<li>&#x5B8C;&#x6210; 1 &#x5E27;&#x4FE1;&#x606F;&#x7684;&#x53D1;&#x9001;&#xFF0C;&#x5355;&#x7247;&#x673A;&#x7F6E;&#x4F4D; <code>TI</code> &#x4E3A; <code>1</code> &#xFF0C;&#x53D1;&#x9001;&#x4E2D;&#x65AD;&#xFF1B;</li>
<li>&#x82E5; <code>REN</code> &#x4E3A; <code>1</code> &#xFF0C;&#x5219;&#x91C7;&#x6837; <code>RXD</code> &#xFF0C;&#x91C7;&#x6837;&#x5230; <code>1</code> -&gt; <code>0</code> &#x7684;&#x8DF3;&#x53D8;&#xFF0C;&#x8FC7;&#x534A;&#x4E2A;&#x6570;&#x4F4D;&#x65F6;&#x95F4;&#x518D;&#x91C7;&#x6837;&#x4E00;&#x6B21;&#xFF0C;&#x82E5;&#x4ECD;&#x7136;&#x4E3A; <code>0</code> &#xFF0C;&#x4EE5;&#x540E;&#x6BCF;&#x7ECF;&#x8FC7;&#x4E00;&#x4E2A;&#x6570;&#x4F4D;&#x65F6;&#x95F4;&#x8BFB;&#x4E00;&#x6B21;&#x6570;&#x636E;&#xFF1B;</li>
<li>&#x63A5;&#x6536;&#x5B8C;&#x6570;&#x636E;&#xFF0C;&#x7F6E;&#x4F4D; <code>RI</code> &#x4E3A; <code>1</code> &#xFF0C;&#x53D1;&#x9001;&#x4E2D;&#x65AD;&#x8BF7;&#x6C42;&#x3002;</li>
</ul>
</li>
</ul>
<ul>
<li>&#x5DE5;&#x4F5C;&#x65B9;&#x5F0F; 2 &#xFF1A;9&#x4F4D; UART&#xFF0C;&#x6CE2;&#x7279;&#x7387; <script type="math/tex; ">\frac{1}{64f_{OSC}}</script> &#x6216; <script type="math/tex; ">\frac{1}{32f_{OSC}}</script></li>
<li>&#x5DE5;&#x4F5C;&#x65B9;&#x5F0F; 3 &#xFF1A;9&#x4F4D; UART&#xFF0C;&#x6CE2;&#x7279;&#x7387; &#x53EF;&#x53D8;<ul>
<li>&#x9664;&#x53BB;&#x5728; <code>SBUF</code> &#x4E2D;&#x7684; 8 &#x4F4D;&#x6570;&#x636E;&#xFF0C;&#x7B2C; 9 &#x4F4D;&#x7531; <code>TB8</code> / <code>RB8</code> &#x6765; &#x53D1;&#x9001;/&#x63A5;&#x6536;&#x3002;</li>
<li>&#x6CE2;&#x7279;&#x7387;<br><script type="math/tex; ">工作方式2:\qquad 波特率=\frac{2^{SMOD}}{64}\times f_{OSC}\\\\工作方式1、3:\quad 波特率=\frac{2^{SMOD}}{32}\times T/C_1的溢出率</script></li>
<li>&#x5B9A;&#x65F6;/&#x8BA1;&#x6570;&#x5668;&#x7684;&#x6EA2;&#x51FA;&#x7387;<ul>
<li>&#x5B9A;&#x4E49;&#xFF1A;&#x6BCF;&#x79D2; <code>T/Ci</code> &#x8BA1;&#x6570;&#x56DE;&#x6EE1;&#x6EA2;&#x51FA;&#x7684;&#x6B21;&#x6570;&#xFF1B;</li>
<li>&#x8BA1;&#x7B97;&#x516C;&#x5F0F;&#xFF1A;<br><script type="math/tex; ">T/C_1溢出率=\frac{f_{OSC}}{12\times (2^8-N)}次/秒</script><br>&#x5176;&#x4E2D;&#xFF0C;<script type="math/tex; ">N</script> &#x8868;&#x793A;&#x5B9A;&#x65F6;&#x8BA1;&#x6570;&#x7684;&#x521D;&#x503C;&#xFF0C;&#x4E5F;&#x662F;&#x7F16;&#x7A0B;&#x65F6;&#x9700;&#x8981;&#x6C42;&#x7684;&#x91CF;&#x3002;&#x5728;&#x8BE5;&#x516C;&#x5F0F;&#x4E2D;&#xFF0C;&#x9009;&#x7528;&#x7684;&#x65F6; <code>T/Ci</code> &#x5DE5;&#x4F5C;&#x4E8E;&#x5B9A;&#x65F6;&#x6A21;&#x5F0F;&#x7684;&#x5DE5;&#x4F5C;&#x65B9;&#x5F0F; 2&#x3002;</li>
</ul>
</li>
</ul>
</li>
</ul>
<blockquote id="fn_UART">
<sup>UART</sup>. &#x5168;&#x53CC;&#x5DE5;&#x5F02;&#x6B65;&#x63A5;&#x6536;/&#x53D1;&#x9001;&#x683C;&#x5F0F;&#xFF0C;Universal Asynchronous Receiver/Transmitter<a href="#reffn_UART" title="Jump back to footnote [UART] in the text."> &#x21A9;</a>
</blockquote>
<hr>
<h4 id="&#x5B9E;&#x4F8B;">&#x5B9E;&#x4F8B;</h4>
<p>&#x4F8B;&#xFF1A;&#x81EA;&#x53D1;&#x81EA;&#x6536; <code>20H</code> &#x5F00;&#x59CB;&#x7684; 10 &#x4E2A;&#x6570;&#xFF0C;&#x7ECF;&#x4E32;&#x53E3;&#x4F20;&#x81F3; <code>30H</code> &#x5F00;&#x59CB;&#x7684;&#x5355;&#x5143;&#x3002;<br>&#x7531;&#x4E66; <code>P154</code> &#x7684;&#x8868;6.3&#xFF0C;&#x9009;&#x62E9;&#x6CE2;&#x7279;&#x7387; 4.8k&#xFF0C;&#x4E32;&#x53E3;&#x901A;&#x4FE1;&#x65B9;&#x5F0F;&#x9009;&#x62E9;&#x65B9;&#x5F0F; 1&#xFF0C;&#x5B9A;&#x65F6;&#x5668;&#x9009;&#x62E9;&#x65B9;&#x5F0F; 2 &#xFF0C;&#x6240;&#x4EE5;&#x88C5;&#x5165;&#x8BA1;&#x6570;&#x521D;&#x503C; <code>FAH</code>&#x3002;</p>
<pre><code class="lang-51">    ORG     0000H
    SJMP    MAIN                ; &#x8F6C;&#x5411;&#x4E3B;&#x7A0B;&#x5E8F;
    ORG     0023H               ; &#x7F16;&#x5199;&#x4E32;&#x53E3;&#x7684;&#x4E2D;&#x65AD;&#x5904;&#x7406;&#x7A0B;&#x5E8F;&#xFF0C;RI | TI = 0 &#x8FDB;&#x4E2D;&#x65AD;
    JBC     TI,     L1          ; &#x53D1;&#xFF1F;&#x90A3;&#x8F6C; L1&#xFF0C;&#x5426;&#x5219;&#x5728; L3
L3:
    CLR     RI                  ; &#x5148;&#x5C06;&#x8BFB;&#x4E2D;&#x65AD;&#x6807;&#x5FD7;&#x4F4D;&#x6E05;&#x96F6;
    MOV     A,      SBUF        ; 
    MOV     @R1,    A           ; &#x5C06;&#x6570;&#x636E;&#x5199;&#x5165; 3xH &#x5355;&#x5143;
    INC     R1
    DJNC    R7,     L2          ; &#x6CA1;&#x5230; 10 &#x6B21;&#xFF1F;&#x7ED3;&#x675F;&#x672C;&#x6B21;&#x4E2D;&#x65AD;
    CLR     ES                  ; &#x5DF2;&#x7ECF;&#x4F20;&#x8F93;&#x4E86; 10 &#x4E2A;&#x6570;&#x636E;&#xFF0C;&#x5173;&#x95ED;&#x4E32;&#x884C;&#x4E2D;&#x65AD;
L2:
    RETI
L1:
    MOV     A,      @R0         ; &#x5C06; 2xH &#x5355;&#x5143;&#x7684;&#x6570;&#x636E;&#x4F20;&#x5165; A
    INC     R0
    MOV     SBUF,   A           ; &#x5F00;&#x59CB;&#x4F20;&#x6570;&#x636E;
    JNB     RI,     L2          ; &#x672A;&#x8BFB;&#xFF0C;10 &#x4E2A;&#x4EE5;&#x5230;&#xFF0C;&#x7ED3;&#x675F;
    SJMP    L3                  ; &#x5426;&#x5219;&#x7EE7;&#x7EED;&#x8BFB;

MAIN:
    MOV     R0,     #20H
    MOV     R1,     #30H
    MOV     R7,     #10         ; &#x5FAA;&#x73AF;&#x8BA1;&#x6570;

    SETB    EA                 ; &#x4E2D;&#x65AD;&#x603B;&#x5F00;&#x5173;

    ; &#x8BBE;&#x7F6E;&#x5B9A;&#x65F6;&#x5668;
    SETB    ET1                 ; &#x5F00; T/C1 &#x4E2D;&#x65AD;&#x5F00;&#x5173;
    ANL     TMOD,   #0FH
    ORL     TMOD,   #0010 1111B ; &#x4F7F;&#x7528; T/C1 &#x7684;&#x65B9;&#x5F0F; 2&#xFF0C;&#x5B9A;&#x65F6;
    MOV     TH1,    #0FAH       ; &#x8BBE;&#x7F6E;&#x521D;&#x503C;&#xFF0C;&#x6EA2;&#x51FA;&#x540E;&#x81EA;&#x52A8;&#x88C5;&#x5165; TL1
    MOV     TL1,    #0FAH       ; &#x8BA1;&#x6570;&#x5668;
    SETB    TR1                 ; &#x542F;&#x52A8; TR1 &#x5DE5;&#x4F5C;

    ; &#x8BBE;&#x7F6E;&#x4E32;&#x53E3;
    SETB    ES                  ; &#x5F00;&#x4E32;&#x884C;&#x53E3;&#x4E2D;&#x65AD;&#x5F00;&#x5173;
    MOV     SCON,   #0101 0000B ; &#x5DE5;&#x4F5C;&#x65B9;&#x5F0F; 1&#xFF0C;&#x5141;&#x8BB8;&#x63A5;&#x6536;
    MOV     A,      @R0         ; &#x5411; `A` &#x4F20;&#x5165; `20H` &#x7684;&#x6570;&#x636E;
    INC     R0
    MOV     SBUF,   A           ; &#x5F00;&#x59CB;&#x4F20;&#x8F93;&#xFF0C;&#x7531; TI &#x3001; RI &#x89E6;&#x53D1;&#x4E2D;&#x65AD;
    SJMP    $
</code></pre>

                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="../3-communication/几个用到的寄存器.html" class="navigation navigation-prev " aria-label="Previous page: 几个用到的寄存器"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="../4-external/index.html" class="navigation navigation-next " aria-label="Next page: 外部扩展"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="../gitbook/app.js"></script>

    
    <script src="https://cdn.mathjax.org/mathjax/2.5-latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-mathjax/plugin.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-search/lunr.min.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-search/search.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"mathjax":{"forceSVG":false},"highlight":{},"search":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2}};
    gitbook.start(config);
});
</script>

        
    </body>
    
</html>
